<?php

namespace app\api\controller\v1;

use app\api\validate\DishValidate;
use app\lib\exception\DishMissException;
use think\Controller;

class Dish extends Controller
{
    //
    public function getDishList($dish_cate)
    {
        // 创建验证器
        (new DishValidate())->goCheck();
        $dish = \app\api\model\Dish::getDishByCate($dish_cate);

        if (!$dish) {
            throw new DishMissException();
        }

        return ['dish' => $dish];
    }
}
